/*
 * Copyright (c) 2005, 2014 vacoor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
Ext.define('Nothing.view.role.RoleManage', {
    extend: 'Nothing.ux.panel.DataViewer',
    alias: ['widget.roleMgt'],
    uses: ['Nothing.ux.form.TreePicker', 'Ext.ux.form.field.ClearButton'],

    store: 'Roles',
    autoGenItems: true,
    items: [
        {
            // fieldLabel: '自动生成'
            name: 'name',
            fieldType: 'S',
            xtype: 'textfield',
            plugins: ['clearbutton']
        },
        {
            // fieldLabel: '自动生成'
            name: 'desc',
            fieldType: 'S',
            xtype: 'textfield',
            plugins: ['clearbutton']
        },
        {
            // fieldLabel: '自动生成'
            name: 'enabled',
            fieldType: 'B',
            xtype: 'textfield',
            plugins: ['clearbutton'],
            permission: 'sh'
        }
    ],

    columns: [
        {

            header: '名称',
            dataIndex: 'name',
            flex: 1,
            editor: {   // 这里可以直接写字符串
                xtype: 'textfield',
                allowBlank: false,
                regex: /^[a-zA-Z0-9]{6,12}$/,
                // regexText: '只能是6~12位字母或数字'
                invalidText: '只能是6~12位字母或数字'
            }
        },
        {

            header: '描述',
            dataIndex: 'desc',
            flex: 1,
            editor: {   // 这里可以直接写字符串
                xtype: 'textfield'
            }
        },
        {
            header: '状态', dataIndex: 'enabled', xtype: 'booleancolumn', trueText: '启用', falseText: '禁用',
            editor: {
                xtype: 'combo',
                store: [
                    [true, '启用'],
                    [false, '禁用']
                ]
            }
        }
    ]
});
